package com.mall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.entity.OmsCartItem;
import com.mall.entity.SmsCoupon;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OmsCartItemMapper extends BaseMapper<OmsCartItem> {

    @Select("select * from oms_cart_item where member_id=#{id} and delete_status = 0")
    List<OmsCartItem> getByMemberId(@Param("id") Long id);

    @Delete("delete from oms_cart_item where member_id=#{memberId} and product_id = #{productId}")
    void removeUsed(@Param("memberId") Long memberId,@Param("productId") Long productId);

    @Select("select * from oms_cart_item where member_id=#{memberId} and product_id = #{productId}")
    OmsCartItem getSame(@Param("memberId") Long memberId,@Param("productId") Long productId);
}
